package hczc.longcai.com.hccrowdfunding.application;


import android.content.SharedPreferences;

import com.facebook.drawee.backends.pipeline.Fresco;
import com.zcx.helper.app.AppApplication;
import com.zcx.helper.init.Helper;
import com.zcx.helper.scale.ScaleScreenHelper;
import com.zcx.helper.scale.ScaleScreenHelperFactory;

import hczc.longcai.com.hccrowdfunding.database.DBAddressController;
import hczc.longcai.com.hccrowdfunding.database.DBIndexController;
import hczc.longcai.com.hccrowdfunding.database.DBUserInfoController;
import hczc.longcai.com.hccrowdfunding.utils.bitmaputils.ImageLoader;

/**
 * 程序的入口，初始化一些重要的工具
 * Created by Administrator on 2016/1/8.
 */
public class BaseApplication extends AppApplication {

    private final String PRE_NAME = "jijin";

    /**
     * 屏幕适配工具类
     */
    public static ScaleScreenHelper scaleScreenHelper;
    /**
     * Address数据库操作类
     */
    public static DBAddressController dbAddressController;
    /**
     * 初始化SharedPreference
     */
    public static SharedPreferences mSharedPreferences;
    /**
     * 主页数据库操作类
     */
    public static DBIndexController dbIndexController;
    /**
     * 用户信息数据库操作类
     */
    public static DBUserInfoController dbUserInfoController;
    /**
     * 图片缓存类
     */
    public static ImageLoader imageLoader;

    @Override
    public void onCreate() {
        super.onCreate();
        Helper.Initialize(this, "HCCrowdfunding");
        scaleScreenHelper = ScaleScreenHelperFactory.create(this, 720);
        dbAddressController = new DBAddressController(getApplicationContext());
        mSharedPreferences = getSharedPreferences(PRE_NAME,MODE_PRIVATE);
        dbIndexController = new DBIndexController(getApplicationContext());
        dbUserInfoController = new DBUserInfoController(getApplicationContext());
        imageLoader = new ImageLoader(getApplicationContext());
        Fresco.initialize(getApplicationContext());
    }



}
